package session09;

import session09.compent.FontPanel;
import session09.compent.JButtonPanel;
import session09.compent.PanePanel;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class SelectPanel extends PanePanel {

    private JButtonPanel modify;
    private JButtonPanel query;
    private JButtonPanel save;
    private JButtonPanel take;
    private JButtonPanel exit;

    private FontPanel txt;

    public SelectPanel(ATMFrame frame) {
        super(200, 250, 180);
        this.modify = new JButtonPanel("image/buttonModify.jpg", 35, 200);
        this.modify.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Container atm = frame.getContentP();
                CardLayout cardLayout = (CardLayout) atm.getLayout();
                cardLayout.show(atm, "modify");
            }
        });
        this.getBackLab().add(this.modify);
        this.query = new JButtonPanel("image/buttonFind.jpg", 35, 300);
        this.query.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Container atm = frame.getContentP();
                CardLayout cardLayout = (CardLayout) atm.getLayout();
                cardLayout.show(atm, "query");
            }
        });
        this.getBackLab().add(this.query);
        this.save = new JButtonPanel("image/buttonSave.jpg", 850, 200);
        this.save.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Container atm = frame.getContentP();
                CardLayout cardLayout = (CardLayout) atm.getLayout();
                cardLayout.show(atm, "save");
            }
        });
        this.getBackLab().add(this.save);
        this.take = new JButtonPanel("image/buttonGet.jpg", 850, 300);
        this.take.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Container atm = frame.getContentP();
                CardLayout cardLayout = (CardLayout) atm.getLayout();
                cardLayout.show(atm, "take");
            }
        });
        this.getBackLab().add(this.take);
        this.exit = new JButtonPanel("image/buttonOff.jpg", 442, 600);
        this.exit.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Container atm = frame.getContentP();
                CardLayout cardLayout = (CardLayout) atm.getLayout();
                cardLayout.show(atm, "login");
            }
        });
        this.getBackLab().add(this.exit);

        this.txt = new FontPanel(20, 60,50,450,50);
        this.txt.setText("请选择业务");
        this.getImgLab().add(this.txt);
    }
}
